# -*- coding:utf-8 -*- #

def gethostname(taskid,param):

    '''
    rsync同步操作
    param:{'remote_dir': '/www/facebook', 
           'model_name': 'flowershop', 
           'rsync_server': '192.168.168.200'}
    
    '''
    import os
    
    result = {'code':0,'msg':'','errmsg':''}
    
    rsyncArgs = "-vzrtopg --progress --delete "
    src = "%s::%s" % (param['rsync_server'],param['model_name'])
    dst = param['remote_dir']
    
    if not os.path.isdir(dst): os.makedirs(dst)

    rdt = RsyncDirectoryTree()
    
    return rdt.rsync(src, dst, args=rsyncArgs)
    


